﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Install & Uninstall</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>
<H1><FONT color=#0000ff>Uninstall a application&nbsp;by 
code</FONT>   </H1>
<H4><EM><FONT color=#808000>luôn xuất hiện hộp thoại 
uninstall&nbsp;confirm ? - chưa xử lý bỏ đi được</FONT></EM></H4>
<P><FONT face=Arial size=2><U>D:\PhucAndroid\Demos</U></FONT></P>
<P><FONT face=Arial size=2><STRONG>Uri</STRONG> packageURI = 
<STRONG>Uri</STRONG>.<STRONG><EM>parse</EM></STRONG>("package:demos.act");<BR><STRONG>Intent</STRONG> 
uninstallIntent = new <STRONG>Intent</STRONG>(Intent.<FONT 
color=#800000>ACTION_DELETE</FONT>, 
packageURI);<BR><STRONG><EM>startActivity</EM></STRONG>(uninstallIntent);</FONT></P>
<P><FONT face=Arial size=2>int result 
= Settings.Secure.getInt(getContentResolver(), Settings.Secure.<FONT 
color=#ff00ff><FONT color= #000000 
> 
<FONT color=#800000>INSTALL_NON_MARKET_APPS</FONT>  
, 0);<BR>if (result != 0) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // show some dialog 
here<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// and may be show application settings dialog 
manually<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Intent intent = new 
Intent();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
intent.setAction(Settings.<FONT 
color=#800000>ACTION_APPLICATION_SETTINGS</FONT> 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
startActivity(intent);<BR>}<BR>&nbsp;&nbsp;<BR></P></FONT></FONT></FONT></body>
</html>
